Declare Function LineTo Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Declare Function MoveToEx Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal lpPoint As Long) As Long
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Public Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest
Public Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest
Public Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest
Public Const PI = 3.1415926
Public Const PI2 = 3.1415926 * 2
Public flock As New Collection
Public objects As New Collection
Public Sub AddBoid(flock As Collection, X As Integer, Y As Integer, ByVal Dir As Integer, Bcol As Long)
'helper function to add Boid to the specified collection (flock)
Dim Colour As Integer
Dim boid As BoidClass
Set boid = New BoidClass
boid.X = X
boid.Y = Y
boid.Colour = Bcol
boid.id = flock.Count
boid.direction = Dir
boid.speed = 10
flock.Add boid
Set boid = Nothing
End Sub
Public Sub AddObstacle(objects As Collection, X As Integer, Y As Integer, ByVal Radius As Integer)
Dim obs As ObstacleClass
Set obs = New ObstacleClass
obs.X = X
obs.Y = Y
obs.id = objects.Count
obs.Radius = Radius
objects.Add obs
Set obs = Nothing
End Sub
Sub DrawBoid(flock As Collection, Canvas As PictureBox, ShowColours As Boolean, ShowArrow As Boolean, ShowCircle As Boolean)
Sub DrawObjects(objects As Collection, Canvas As PictureBox)
Dim obs As ObstacleClass
For Each obs In objects
Canvas.Circle (obs.X, obs.Y), obs.Radius
Next
Set obs = Nothing
End Sub
Sub DrawForces(flock As Collection, Canvas As PictureBox, SensorDist As Integer, ViewTheta As Single, ShowCentre As Boolean, ShowSep As Boolean, ShowAlign As Boolean, ShowSensor As Boolean, ShowBox As Boolean)